import { createI18n } from "vue-i18n";
import { Utils } from '@/common/utils';

/*语言配置*/
export const Language = {
    zh: 'zh',
    en: 'en',
    kai: 'kai',
    kaien: 'kaien',
    xiaomao: 'xiaomao',
    xiaomaoen: 'xiaomaoen'
}

export function setupI18n(callback: (i18n: any) => void) {
    Utils.getModules((import.meta as any).glob('./modules/*.ts')).then(messages => {
        // @ts-ignore
        const i18n = new createI18n({
            locale: Language.kai,
            legacy: false,
            globalInjection: true,
            messages
        });
        callback(i18n);
    });
}